home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl5 / Apache / RPC / status.xpl < prev   
Encoding:
Extensible Markup Language  |  2008-11-04  |  5.0 KB  |  125 lines

  1. <?xml version="1.0" encoding="iso-8859-1"?>
  2. <!DOCTYPE methoddef SYSTEM "rpc-method.dtd">
  3. <!--
  4.     Generated automatically by make_method v1.12, Wed Nov  5 03:59:22 2008
  5.  
  6.     Any changes made here will be lost.
  7. -->
  8. <methoddef>
  9. <name>system.status</name>
  10. <version>1.2</version>
  11. <signature>struct</signature>
  12. <signature>struct boolean</signature>
  13. <help>
  14. Report on the various status markers of the server itself. The return value is
  15. a STRUCT with the following members:
  16.  
  17.         Key         Type     Value
  18.  
  19.         host        STRING   Name of the (possibly virtual) host name to which
  20.                              requests are sent.
  21.         port        INT      TCP/IP port the server is listening on.
  22.         name        STRING   The name of the server software, as it identifies
  23.                              itself in transport headers.
  24.         version     STRING   The software version. Note that this is defined as
  25.                              a STRING, not a DOUBLE, to allow for non-numeric
  26.                              values.
  27.         path        STRING   URL path portion, for use when sending POST
  28.                              request messages.
  29.         child_pid   INT      The process ID of the child serving this request.
  30.         date        ISO8601  The current date and time on the server, as an
  31.                              ISO 8601 date string.
  32.         date_int    INT      The current date as a UNIX time() value. This is
  33.                              encoded as an INT rather than the dateTime.int
  34.                              type, so that it is readable by older clients.
  35.         started     ISO8601  The date and time when the current server started
  36.                              accepting connections, as an ISO 8601 string.
  37.         started_int
  38.                     INT      The server start-time as a UNIX time() value. This
  39.                              is also encoded as INT for the same reasons as
  40.                              the "date_int" value above.
  41.         child_started
  42.                     ISO8601  The date and time when this child process was
  43.                              created by the master Apache/mod_perl process.
  44.         child_started_int
  45.                     INT      As above.
  46.         total_requests
  47.                     INT      Total number of requests served thus far
  48.                              (including the current one). This will not include
  49.                              requests for which there was no matching method,
  50.                              or HTTP-HEAD requests.
  51.         methods_known
  52.                     INT      The number of different methods the server has
  53.                              registered for serving requests.
  54.  
  55. This is a slightly different system.struct implementation instrumented for
  56. use in an Apache/mod_perl environment.
  57.                                                                                 
  58. If this method is called with a single boolean value, that value determines
  59. whether the current call should be counted against the value of the
  60. "total_requests" field. This is also handled at the server level. Setting
  61. this boolean value to a "true" value causes the server (and the resulting
  62. data structure returned) to not count this call. This feature allows external
  63. tools (monitors, etc.) to check the status regularly without falsely running
  64. up the value of "total_requests".
  65. </help>
  66. <code language="perl">
  67. <![CDATA[
  68. #!/usr/bin/perl
  69. ###############################################################################
  70. #
  71. #   Sub Name:       status
  72. #
  73. #   Description:    Create a status-reporting struct and returns it.
  74. #
  75. #   Arguments:      NAME      IN/OUT  TYPE      DESCRIPTION
  76. #                   $srv      in      ref       Server object instance
  77. #
  78. #   Globals:        None.
  79. #
  80. #   Environment:    None.
  81. #
  82. #   Returns:        hashref
  83. #
  84. ###############################################################################
  85. sub status
  86. {
  87.     use strict;
  88.  
  89.     my $srv = shift;
  90.     my $no_inc = shift || 0;
  91.  
  92.     my $status = {};
  93.     my $time = time;
  94.     my $URI;
  95.  
  96.     require URI;
  97.  
  98.     $status->{name} = ref($srv);
  99.     $status->{version} = new RPC::XML::string $srv->version;
  100.     $status->{host} = $srv->host || $srv->{host} || '';
  101.     $status->{port} = $srv->port || $srv->{port} || '';
  102.     $status->{path} = new RPC::XML::string $srv->path;
  103.     $status->{child_pid} = $$;
  104.     $status->{date} = RPC::XML::datetime_iso8601
  105.         ->new(RPC::XML::time2iso8601($time));
  106.     $status->{started} = RPC::XML::datetime_iso8601
  107.         ->new(RPC::XML::time2iso8601($srv->started));
  108.     $status->{child_started} = RPC::XML::datetime_iso8601
  109.         ->new(RPC::XML::time2iso8601($srv->child_started));
  110.     $status->{date_int} = $time;
  111.     $status->{started_int} = $srv->started;
  112.     $status->{child_started_int} = $srv->child_started;
  113.     $status->{total_requests} = $srv->requests;
  114.     # In special cases where the call to system.status is not going to incr
  115.     # the total, don't add the extra here, either...
  116.     $status->{total_requests}++ unless $no_inc;
  117.     $status->{methods_known} = scalar($srv->list_methods);
  118.  
  119.     $status;
  120. }
  121.  
  122. __END__
  123. ]]></code>
  124. </methoddef>
  125.